package com.ruoyi.project.order.vo;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import com.ruoyi.common.constant.OrderCheckStatu;
import com.ruoyi.common.constant.OrderStatu;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.regex.Pattern;

@Data
public class OrderListVo {

    /**
     *
     */
    @Excel(name = "工单编号")
    private Integer orderId;


    /**
     *
     */
    private Integer workerId;


    /**
     *
     */
    private Integer publisherId;


    /**
     *
     */
    private Integer checkerId;


    /**
     * 工单标题
     */
    @Excel(name = "工单标题")
    private String orderTitle;
    /**
     * 工单类型
     */
    @Excel(name = "工单类型")
    private String typeName;

    /**
     * 订单实施费
     */
    @Excel(name = "实施费")
    private Double orderMoney;
    /**
     * 订单快递费
     */
    @Excel(name = "快递费")
    private Double orderPostMoney;
    /**
     * 订单打车费
     */
    @Excel(name = "打车费")
    private Double orderCarMoney;
    /**
     * 订单其他费
     */
    @Excel(name = "其他费")
    private Double orderOtherMoney;
    /**
    /**
     * 工单状态
     */
    @Excel(name = "工单状态", readConverterExp = "0=待确认" +
            ",1=处理中" +
            ",2=已完成" +
            ",3=已关闭" +
            ",4=已评价")
    private String orderStatus;

    /**
     * 审核状态
     */
    @Excel(name = "审核状态", readConverterExp = "0=未审核,1=任务成功,2=任务失败")
    private String checkStatus;

    /**
     * 工单评价
     */
    @Excel(name = "工单评价")
    private String orderComment;

    /**
     * 工单内容
     */
    @Excel(name = "工单内容")
    private String orderContent;


    /**
     * 接单人
     */
    @Excel(name = "接单人")
    private String worker;
    @Excel(name = "客户姓名")
    private String customerName;
    @Excel(name = "客户手机号")
    private String customerPhone;
    @Excel(name = "客户地址")
    private String customerAddress;
    /**
     * 客户联系人
     */
    @TableField("customerLinkman")
    @Excel(name = "客户联系人")
    private String customerLinkman;

    /**
     * 发布者
     */
    @Excel(name = "发单人")
    private String publisher;

    /**
     * 审核者
     */
    @Excel(name = "审核人")
    private String checker;

    /**
     * 客户
     */
    private String customer;
    @Excel(name = "接单人手机号")
    private String workerPhone;


    /**
     * 工单创建时间
     */
    @Excel(name = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime orderCreateTime;

    /**
     * 工单开始时间
     */
    @Excel(name = "规定开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime orderStartTime;

    /**
     * 工单结束时间
     */
    @Excel(name = "规定结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime orderEndTime;

    /**
     * 工单实际结束时间
     */
    @Excel(name = "实际结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime orderFinishTime;

    private Integer orderNum;

    public String getOrderCreateTime() {
        return DateUtil.formatLocalDateTime(orderCreateTime);
    }

    public String getOrderStartTime() {
        return DateUtil.formatLocalDateTime(orderStartTime);
    }

    public String getOrderEndTime() {
        return DateUtil.formatLocalDateTime(orderEndTime);
    }

    public String getOrderFinishTime() {
        return DateUtil.formatLocalDateTime(orderFinishTime);
    }

    public String getOrderStatus() {
        return OrderStatu.getByValue(Integer.parseInt(orderStatus)).getName();
    }

    public String getCheckStatus() {
        return OrderCheckStatu.getByValue(Integer.parseInt(checkStatus)).getName();
    }
}
